import request from '@/utils/axiosRequest'
import useEnv from "@/hooks/useEnv";
const show = useEnv.VITE_FILE_API + "/shows?uuid="

const getCategories = (x) => {
    return request({
        url: '/category/selectByPag?index=' + x.index + '&size=' + x.size + '&searchName=' + x.searchName
    })
}

const addCategory = (data) => {
    return request({
        url: '/category/add',
        data: data,
        method: 'post'
    })
}

const updateCategory = (data) => {
    return request({
        url: '/category/update',
        data: data,
        method: 'post'
    })
}
const delCategory = (id) => {
    return request({
        url: '/category/delete?id=' + id,
        method: 'delete'
    })
}

const getCreations = (x) => {
    return request({
        url: '/photo/selectByPag?index=' + x.index + '&size=' + x.size + '&searchName=' + x.searchName +
            '&searchValue1=' + x.searchValue1 + '&searchValue2=' + x.searchValue2 + '&searchValue3=' + x.searchValue3
    })
}

const getComments = (x) => {
    return request({
        url: '/comment/selectByPag?index=' + x.index + '&size=' + x.size + '&searchName=' + x.searchName +
            '&searchValue1=' + x.searchValue1 + '&searchValue2=' + x.searchValue2
    })
}



export default {
    delCategory,
    updateCategory,
    addCategory,
    getCategories,
    getCreations,
    getComments,
    show
}